<template>
  <div>
    <div>
      <!--   style="cursor: pointer"   光标：指针 变成手 -->
      <span style="cursor: pointer"></span>
      <div style="padding-top: 30px; margin-top: 10px;">
        <el-breadcrumb  >
          <el-breadcrumb-item :to="'/'">首页</el-breadcrumb-item>
          <el-breadcrumb-item>{{ currentPathName }}</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
    </div>
    <el-dropdown size="medium"  style="width: 150px; text-align: right">
<!--     3_26:用户头像动态显示修改 -->
      <div>
        <img :src="user.avatar"
             style="width: 20px; border-radius: 50%;">
        <span>{{user.nikeName}}</span><i class="el-icon-arrow-down" style="margin-right: 30px"></i>
      </div>
      <el-dropdown-menu  slot="dropdown" style="padding-top: 0px;" >
        <el-dropdown-item >
          <router-link to="/person">个人中心</router-link>
        </el-dropdown-item>
        <el-dropdown-item >
<!--          <router-link to="login" @click="logout">退出</router-link>-->
          <span @click="logout">退出</span>
        </el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>

</template>

<script>
import user from "@/views/User";

export default {
  name: "Header",
  /*props:  {
    //collapseBtnClass:??
    collapseBtnClass: String,
    logTextShow: Boolean
  }*/
  props: {
    user: Object
  },
  computed: {
    currentPathName () {
      return this.$store.state.currentPathName;　　//需要监听的数据
    }
  },
  watch: {
    currentPathName (newVal, oldVal) {
      /*console.log(newVal)*/
      /*console.log(localStorage.getItem("user"))*/
    }
  },
  data(){
    return{
        /*3_26：获取用户名转JSON*/
        /*user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")):{}*/
    }
  },
  created() {
    //打印侧边栏路由信息
    /*console.log(this.$route)*/
  },
  methods: {
    /*3_26：用户退出click事件事件*/
    logout(){
      this.$router.push("/login")
      localStorage.removeItem("user")
      localStorage.removeItem("menus")
      /*this.$store.commit("logout")*/
      this.$message.success("用户退出成功")
    }
  }
}
</script>

<style scoped>

</style>